// component/hotList/hotList.js
import { Home } from 'toplist-model.js'
var home = new Home();
var WxParse =require("../../wxParse/wxParse.js")
var that
import { Info } from 'topListInfo-model.js'
var info = new Info();
Component({
  options: {
    styleIsolation: 'shared',
  },
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    
  },
  ready(){
    that = this
    wx.getSystemInfo({
      success: (result) => {
        console.log(result)
        this.setData({
          deviceH:result.windowHeight - 80
        })
      },
    })
    this._getData()
  },
  /**
   * 组件的方法列表
   */
  methods: {
    _getList(id){
      var data = info.getList(id,(res)=>{
        console.log(res)
        this.setData({
          "musicList": res.songlist
        })
        this.setData({
          topinfo: res,
          //musicList: res.songlist
        })
        var article = res.topinfo.info;
        WxParse.wxParse('article', 'html', article, this, 5);
      })
    },
    _getData(){
      var id=2;
      var data = home.getTopList(id,(res)=>{
        console.log(res)
        this.setData({
          "topList": res.data.topList
        });
      })
    },
    hideModal(e) {
      this.setData({
        modalName: null
      })
    },
    toList(event){
      console.log(event.currentTarget.dataset.id)
      var id = event.currentTarget.dataset.id;
      that._getList(id)
      this.setData({
        modalName:'DrawerModalR'
      })
    }
  }
})
